package com.google.android.exoplayer2.metadata.scte35;

import android.os.Parcel;
import android.os.Parcelable.Creator;
import com.huawei.hms.framework.network.restclient.hwhttp.dns.DnsConfig;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import o.anc;

public final class SpliceScheduleCommand extends SpliceCommand {
    public static final Creator<SpliceScheduleCommand> CREATOR = new Creator<SpliceScheduleCommand>() {
        public /* synthetic */ Object createFromParcel(Parcel parcel) {
            return ˊ(parcel);
        }

        public /* synthetic */ Object[] newArray(int i) {
            return ˋ(i);
        }

        public SpliceScheduleCommand ˊ(Parcel parcel) {
            return new SpliceScheduleCommand(parcel);
        }

        public SpliceScheduleCommand[] ˋ(int i) {
            return new SpliceScheduleCommand[i];
        }
    };
    public final List<e> ˋ;

    public static final class b {
        public final int ˊ;
        public final long ॱ;

        private b(int i, long j) {
            this.ˊ = i;
            this.ॱ = j;
        }

        private static b ˋ(Parcel parcel) {
            return new b(parcel.readInt(), parcel.readLong());
        }

        private void ˎ(Parcel parcel) {
            parcel.writeInt(this.ˊ);
            parcel.writeLong(this.ॱ);
        }
    }

    public static final class e {
        public final int ʻ;
        public final List<b> ʼ;
        public final int ʽ;
        public final boolean ˊ;
        public final boolean ˋ;
        public final long ˎ;
        public final boolean ˏ;
        public final int ͺ;
        public final long ॱ;
        public final boolean ॱॱ;
        public final long ᐝ;

        private e(long j, boolean z, boolean z2, boolean z3, List<b> list, long j2, boolean z4, long j3, int i, int i2, int i3) {
            this.ˎ = j;
            this.ˊ = z;
            this.ˏ = z2;
            this.ˋ = z3;
            this.ʼ = Collections.unmodifiableList(list);
            this.ॱ = j2;
            this.ॱॱ = z4;
            this.ᐝ = j3;
            this.ʻ = i;
            this.ʽ = i2;
            this.ͺ = i3;
        }

        private e(Parcel parcel) {
            boolean z;
            boolean z2 = true;
            this.ˎ = parcel.readLong();
            this.ˊ = parcel.readByte() == (byte) 1;
            if (parcel.readByte() == (byte) 1) {
                z = true;
            } else {
                z = false;
            }
            this.ˏ = z;
            if (parcel.readByte() == (byte) 1) {
                z = true;
            } else {
                z = false;
            }
            this.ˋ = z;
            int readInt = parcel.readInt();
            List arrayList = new ArrayList(readInt);
            for (int i = 0; i < readInt; i++) {
                arrayList.add(b.ˋ(parcel));
            }
            this.ʼ = Collections.unmodifiableList(arrayList);
            this.ॱ = parcel.readLong();
            if (parcel.readByte() != (byte) 1) {
                z2 = false;
            }
            this.ॱॱ = z2;
            this.ᐝ = parcel.readLong();
            this.ʻ = parcel.readInt();
            this.ʽ = parcel.readInt();
            this.ͺ = parcel.readInt();
        }

        private static e ˏ(anc o_anc) {
            long j;
            boolean z;
            long ˋॱ = o_anc.ˋॱ();
            boolean z2 = (o_anc.ʽ() & DnsConfig.MAX_CACHE_ENTRIES) != 0;
            boolean z3 = false;
            long j2 = -9223372036854775807L;
            List arrayList = new ArrayList();
            int i = 0;
            int i2 = 0;
            int i3 = 0;
            boolean z4 = false;
            long j3 = -9223372036854775807L;
            if (z2) {
                j = -9223372036854775807L;
                z4 = false;
                z = false;
            } else {
                Object obj;
                long ˋॱ2;
                ArrayList arrayList2;
                int ʽ = o_anc.ʽ();
                boolean z5 = (ʽ & DnsConfig.MAX_CACHE_ENTRIES) != 0;
                boolean z6 = (ʽ & 64) != 0;
                if ((ʽ & 32) != 0) {
                    obj = 1;
                } else {
                    obj = null;
                }
                if (z6) {
                    ˋॱ2 = o_anc.ˋॱ();
                } else {
                    ˋॱ2 = -9223372036854775807L;
                }
                if (z6) {
                    arrayList2 = arrayList;
                } else {
                    int ʽ2 = o_anc.ʽ();
                    arrayList2 = new ArrayList(ʽ2);
                    for (ʽ = 0; ʽ < ʽ2; ʽ++) {
                        arrayList2.add(new b(o_anc.ʽ(), o_anc.ˋॱ()));
                    }
                }
                if (obj != null) {
                    long ʽ3 = (long) o_anc.ʽ();
                    z4 = (128 & ʽ3) != 0;
                    j3 = ((((ʽ3 & 1) << 32) | o_anc.ˋॱ()) * 1000) / 90;
                }
                i = o_anc.ॱॱ();
                i2 = o_anc.ʽ();
                i3 = o_anc.ʽ();
                arrayList = arrayList2;
                z3 = z6;
                j2 = ˋॱ2;
                j = j3;
                z = z4;
                z4 = z5;
            }
            return new e(ˋॱ, z2, z4, z3, arrayList, j2, z, j, i, i2, i3);
        }

        private void ˋ(Parcel parcel) {
            int i;
            int i2 = 1;
            parcel.writeLong(this.ˎ);
            parcel.writeByte((byte) (this.ˊ ? 1 : 0));
            if (this.ˏ) {
                i = 1;
            } else {
                i = 0;
            }
            parcel.writeByte((byte) i);
            if (this.ˋ) {
                i = 1;
            } else {
                i = 0;
            }
            parcel.writeByte((byte) i);
            int size = this.ʼ.size();
            parcel.writeInt(size);
            for (int i3 = 0; i3 < size; i3++) {
                ((b) this.ʼ.get(i3)).ˎ(parcel);
            }
            parcel.writeLong(this.ॱ);
            if (!this.ॱॱ) {
                i2 = 0;
            }
            parcel.writeByte((byte) i2);
            parcel.writeLong(this.ᐝ);
            parcel.writeInt(this.ʻ);
            parcel.writeInt(this.ʽ);
            parcel.writeInt(this.ͺ);
        }

        private static e ˏ(Parcel parcel) {
            return new e(parcel);
        }
    }

    private SpliceScheduleCommand(List<e> list) {
        this.ˋ = Collections.unmodifiableList(list);
    }

    private SpliceScheduleCommand(Parcel parcel) {
        int readInt = parcel.readInt();
        List arrayList = new ArrayList(readInt);
        for (int i = 0; i < readInt; i++) {
            arrayList.add(e.ˏ(parcel));
        }
        this.ˋ = Collections.unmodifiableList(arrayList);
    }

    public static SpliceScheduleCommand ॱ(anc o_anc) {
        int ʽ = o_anc.ʽ();
        List arrayList = new ArrayList(ʽ);
        for (int i = 0; i < ʽ; i++) {
            arrayList.add(e.ˏ(o_anc));
        }
        return new SpliceScheduleCommand(arrayList);
    }

    public void writeToParcel(Parcel parcel, int i) {
        int size = this.ˋ.size();
        parcel.writeInt(size);
        for (int i2 = 0; i2 < size; i2++) {
            ((e) this.ˋ.get(i2)).ˋ(parcel);
        }
    }
}
